/**
 * @description: 需要以字母开头的随机字符串
 * @param length 字符串长度 默认8
 * @return string
 */
const generateString = (length = 8) => {
    const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    const randomChar = () => characters.charAt(Math.floor(Math.random() * characters.length));
    const timestamp = Date.now().toString(36); // Use timestamp for uniqueness
    let result = timestamp + Array.from({ length: length - timestamp.length }, randomChar).join("");
    return result.charAt(0).toUpperCase() + result.slice(1); // Ensure it starts with a letter
};

export { generateString };
